package com.atguigu.gulimall.product.entity;

import com.atguigu.common.valid.AddGroup;
import com.atguigu.common.valid.ListValue;
import com.atguigu.common.valid.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 品牌
 *
 * @author zhough
 * @email zhough@gmail.com
 * @date 2024-01-22 17:20:01
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(message = "品牌名称必须存在", groups = {AddGroup.class, UpdateGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @URL(message = "url必须有效")
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(message = "显示状态不能为空", groups = UpdateGroup.UpdateStatusGroup.class)
    @ListValue(values = {0, 1}, groups = UpdateGroup.UpdateStatusGroup.class, message = "显示状态必须为0或者1")
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @Pattern(regexp = "[a-zA-Z]", message = "检索数据必须是一个字母", groups = UpdateGroup.class)
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序字段必须存在", groups = AddGroup.class)
    @Min(value = 0, message = "排序字段必须为大于等于0的整数", groups = UpdateGroup.class)
    private Integer sort;

}
